package com.cluster.gulimall.coupon.controller;

import com.cluster.gulimall.common.utils.R;
import com.cluster.gulimall.coupon.entity.SmsCoupon;
import com.cluster.gulimall.coupon.service.ICouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

@RestController
@RequestMapping("/coupon")
@RefreshScope
public class CouponController {

    @Autowired
    private ICouponService couponService;

    @RequestMapping("/memberCoupons")
    public R memberCoupons(){
        SmsCoupon smsCoupon = new SmsCoupon();
        smsCoupon.setCouponName("满100减10");
        return  R.ok().put("coupons", Arrays.asList(smsCoupon));
    }

//    @Value("${coupon.user.name}")
//    private String name;
//    @Value("${coupon.user.age}")
//    private Integer age;
//
    @RequestMapping("/test")
    public R test(){
        return  R.ok().put("name", "zhangsan").put("age",18);
    }
}
